import qs from 'qs'

// 检测用户是否登录
const isLogin = () => !!sessionStorage.getItem('token')
// 获取token
const getToken = () => sessionStorage.getItem('token')
// 解决路由的search传参，参数解析问题
const parserSearch = (search) => {
  if (search) throw new Error('请传入参数')
  return qs.parse(search.substr(1))
}

export {
  isLogin,
  parserSearch,
  getToken
}
